<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header', 'admin');
?>
<div class="pad-lr-10">
  <form name="myform" action="?m=guestbook&c=guestbook_admin&a=listorder" method="post">
  <div class="table-list">
    <table width="100%" cellspacing="0">
      <thead>
        <tr>
          <th width="35" align="center"><input type="checkbox" value="" id="check_box" onclick="selectall('gid[]');"></th>
          <th width="38" align="center"><?php echo L('listorder')?></th>
          <th align="center"><?php echo L('title')?></th>
          <th width="150" align="center"><?php echo L('username')?></th>
          <th width="150" align="center">审核状态</th>
          <th width='120' align="center">回复人</th>
          <th width='120' align="center">回复时间</th>
          <th width="69" align="center"><?php echo L('operations_manage')?></th>
        </tr>
      </thead>
      <tbody>
        <?php
        if(is_array($data)){
          foreach($data as $guestbook){?>
          <tr>
            <td align="center"><input type="checkbox" name="gid[]" value="<?php echo $guestbook['gid']?>"></td>
            <td align="center"><input name="listorders[<?php echo $guestbook['gid']?>]" type="text" size="3" value="<?php echo $guestbook['listorder']?>" class="input-text-c input-text"></td>
            <td><?php echo $guestbook['title']?></td>
            <td align="center"><?php echo $guestbook['username']?></td>
            <td align="center"><?php echo ($guestbook['passed']?'<span style="color:green">已审</span>':'<span style="color:red">未审</span>')?></td>
            <td align="center"><?php echo $guestbook['replyname']?></td>
            <td align="center" title="<?php echo date('Y-m-d H:i:s', $guestbook['replytime'])?>"><?php echo date('Y-m-d', $guestbook['replytime'])?></td>
            <td align="center">
              <a href='?m=guestbook&c=guestbook_admin&a=passed&passed=1&gid=<?php echo $guestbook['gid']?>'>审核</a>  |
              <a href="javascript:edit('<?php echo $guestbook['gid']?>', '<?php echo safe_replace($guestbook['title'])?>');void(0);"><?php echo L('edit')?></a>
            </td>
          </tr>
          <?php
          }
        }?>
      </tbody>
    </table>
    <div class="btn">
      <label for="check_box"><?php echo L('selected_all')?>/<?php echo L('cancel')?></label>&nbsp;
      <button type="submit" name="dosubmit" class="button"><?php echo L('order_by')?></button>&nbsp;
      <button type="submit" name="cancel" class="button" onClick="document.myform.action='?m=guestbook&c=guestbook_admin&a=cancel_passed&passed=0'"><?php echo L('cancel_all_selected')?></button>&nbsp;
      <button type="submit" name="delete" class="button" onClick="document.myform.action='?m=guestbook&c=guestbook_admin&a=delete';return confirm('<?php echo L('affirm_delete')?>')"><?php echo L('remove_all_selected')?></button>&nbsp;
    </div>
    <div id="pages"><?php echo $this->db->pages;?></div>
  </form>
</div>
</body>
</html>
<script type="text/javascript">
window.top.$('#display_center_id').css('display','none');

function edit(id, title) {
	window.top.art.dialog({id:'edit'}).close();
	window.top.art.dialog({
    title:'<?php echo L('edit_announce')?>--'+title,
    id:'edit',
    iframe:'?m=guestbook&c=guestbook_admin&a=edit&gid='+id,
    width:'700px',
    height:'500px'
  },
  function(){
    var d = window.top.art.dialog({id:'edit'}).data.iframe;
	  d.document.getElementById('dosubmit').click();
    return false;
  },
  function(){
    window.top.art.dialog({id:'edit'}).close();
  });
}

</script>
